package com.neuedu.spring.service;


import com.neuedu.spring.dao.IUserDao;
import com.neuedu.spring.dao.UserDao;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class UserService {

    //当spirng扫描到属性中有@Resource 会自动的装填（DI）  默认按照类型匹配 byType
    // 如果出现多个类型相同的Bean对象，则可以通过name属性 匹配  byName
    @Resource(name="userDao2")
    private IUserDao userDao1111;


    public void sayUser(){
        System.out.println("UserService.sayUser");
        userDao1111.sayHi();
    }

}
